package com.bh.base.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bh.base.domain.BhUserScore;
import com.bh.base.mapper.BhUserScoreMapper;
import com.bh.base.service.IBhUserScoreService;
import com.bh.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 员工积分Service业务层处理
 * 
 * @author slx
 * @date 2023-07-15
 */
@Service
public class BhUserScoreServiceImpl extends ServiceImpl<BhUserScoreMapper, BhUserScore> implements IBhUserScoreService
{
    @Autowired
    private BhUserScoreMapper bhUserScoreMapper;

    /**
     * 查询员工积分
     * 
     * @param id 员工积分主键
     * @return 员工积分
     */
    @Override
    public BhUserScore selectBhUserScoreById(Long id)
    {
        return bhUserScoreMapper.selectBhUserScoreById(id);
    }

    /**
     * 查询员工积分列表
     * 
     * @param bhUserScore 员工积分
     * @return 员工积分
     */
    @Override
    public List<BhUserScore> selectBhUserScoreList(BhUserScore bhUserScore)
    {
        return bhUserScoreMapper.selectBhUserScoreList(bhUserScore);
    }

    /**
     * 新增员工积分
     * 
     * @param bhUserScore 员工积分
     * @return 结果
     */
    @Override
    public int insertBhUserScore(BhUserScore bhUserScore)
    {
        bhUserScore.setCreateTime(DateUtils.getNowDate());
        return bhUserScoreMapper.insert(bhUserScore);
    }

    /**
     * 修改员工积分
     * 
     * @param bhUserScore 员工积分
     * @return 结果
     */
    @Override
    public int updateBhUserScore(BhUserScore bhUserScore)
    {
        bhUserScore.setUpdateTime(DateUtils.getNowDate());
        return bhUserScoreMapper.updateById(bhUserScore);
    }

    /**
     * 批量删除员工积分
     * 
     * @param ids 需要删除的员工积分主键
     * @return 结果
     */
    @Override
    public int deleteBhUserScoreByIds(Long[] ids)
    {
        return bhUserScoreMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除员工积分信息
     * 
     * @param id 员工积分主键
     * @return 结果
     */
    @Override
    public int deleteBhUserScoreById(Long id)
    {
        return bhUserScoreMapper.deleteById(id);
    }
}
